Repository navigation
fix(kraefte): reconcile the Kräfte rows by id instead of rebuilding them - #531
Merged
Merged
Conversation
Every session.Changed -- a save in any tab, or a change pushed from a joined device -- cleared the Kräfte grid and re-added every row. The Reset made Avalonia re-realise each container, so the selected row lost its highlight and the STATUS combo lost keyboard focus right after the status it had just written. RowReconciler now brings a bound collection in line with the incident by id: rows whose unit is gone are removed, new ones inserted, rows out of place moved, and every kept row updated in place. ForceRow.Update carries an echo guard so a value pulled from the incident is not written back as a local edit, keeps a half-typed Stärke correction unless the incident's Stärke itself moved, and replaces StatusOptions only when the list really differs (the #408 trap). Funktionen and Aufgaben follow in their own pull requests. Refs #294 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First of three PRs for #294. Kräfte only; Funktionen and Aufgaben follow and build on the helper added here.
Every
session.Changed(a save in any tab, or a change from a joined device) ranForces.Clear()and re-added every row. TheResetmakes Avalonia re-realise each row container, so the selected row lost its highlight and the STATUS combo lost focus right after it had saved. The next Down press moved the grid's cell cursor instead of changing the status.Refs #294. The issue stays open until Funktionen and Aufgaben land.
Changes
RowReconciler(new,internal) brings anObservableCollectionin line with the incident by id:Moves rows that are out of place;It never raises a
Resetand never replaces a row by index. TheMovesupport is there for the sorted and filtered Aufgaben and Funktionen lists that come next.ForceRow.Updatebrings a kept row up to date:ForceUnitinstance on every broadcast.ScbaTruppRow.UpdateleavingPressureInputalone.StatusOptions: replaced only when the list really differs. A remote off-catalogue status (chore: small cleanups from the 2026-09 code review (checklist) #302/Should an incident carry the Stammdaten it was created under? #337) still becomes selectable, and the combo'sItemsSourceis never swapped needlessly (the feat(atemschutz): model the Sicherheitstrupp instead of hoping for it #408 trap).RefreshForcescalls the reconciler. The totals, vehicle options and duplicate-Funkrufname code is unchanged.The
UpdateSourceTrigger=LostFocusinForcesView.axamlstays. It is also what fixes Kräfte: typing a Bemerkung saves the whole incident file on every keystroke #33's write per keystroke.No
.axamlchange and nothing visual, so there are no screenshots.Tests (written first, all failed on
main)ForcesViewModelTests:Resetand keeps the same row instances;Reset;SnapshotRoundTrippingSession, updates the row with no write-back (oneChanged, noonChanged);ForcesSelectionSurvivesChangeTests([AvaloniaFact], realForcesView): the selected DataGrid row stays selected across an unrelated change and across its own status edit. Onmainthe selection becomesnull.make clean ci: 8 test runs, all green, 0 warnings.Checklist
src/add one changelog entry inchangelog.d/🤖 Generated with Claude Code